﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>修改计量单位</title>
    <link href="~/libs/layui-v2.9.17/layui/css/layui.css" rel="stylesheet" />
    <script src="~/libs/layui-v2.9.17/layui/layui.js"></script>
    <script src="~/libs/jquery/jquery.js"></script>
</head>
<body>
    <form class="layui-form" action="" onsubmit="return false">
        <div class="layui-form-item">
            <label class="layui-form-label">单位编码</label>
            <div class="layui-input-block">
                <input type="text" id="measureCode" name="measureCode" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">单位名称</label>
            <div class="layui-input-block">
                <input type="text" id="measureName" name="measureName" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否为主单位</label>
            <div class="layui-input-block">
                <input type="radio" id="primaryFlag" name="primaryFlag" value="是" title="是" >
                <input type="radio" id="primaryFlag" name="primaryFlag" value="否" title="否">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否启用</label>
            <div class="layui-input-block">
                <input type="radio" id="enableFlag" name="enableFlag" value="是" title="是" >
                <input type="radio" id="enableFlag" name="enableFlag" value="否" title="否">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" id="remark" class="layui-textarea" name="remark"></textarea>
            </div>
        </div>
        <input type="hidden" id="id" name="id" />
    </form>
    <script type="text/javascript">
        layui.use('form', function () {
            const form = layui.form;
            form.render();
            var meaid = window.location.search.substring(4);
            $.ajax({
                url: '/XiangHe/GetSingleMea?id=' + meaid,
                type: 'get',
                data: $('#form').serialize(),
                success: function (res) {
                    console.log(res)
                    $("#measureCode").val(res.measureCode)
                    $("#measureName").val(res.measureName)
                    $("input[name='primaryFlag'][value='" + res.primaryFlag + "']").prop('checked', true);
                    $("input[name='enableFlag'][value='" + res.enableFlag + "']").prop('checked', true);
                    $("#remark").val(res.remark)
                    $("#id").val(res.id)
                }
            });
        })
    </script>
</body>
</html>